var maxScrollTop=document.getElementById("nav").offsetTop;
document.getElementById("content").onscroll=function(){

    var scrollTop=document.getElementById("content").scrollTop;
//            console.log(scrollTop);
    if(scrollTop>=maxScrollTop){
        document.getElementById("nav").style.position="fixed";
        document.getElementById("nav").style.top="0px";
//                document.getElementById("nav").style.left="0px";
    }
    if(scrollTop<maxScrollTop){
        document.getElementById("nav").style.position="static";
    }
}